// nav导航标签设置

// id
let url=decodeURI(window.location.href);
var cs=url.split("?")[1].split("=");
var csvalue=+cs[1];
console.log(csvalue);

// 渲染部分
var ulxuan=document.querySelector(".ulxuan");
let xhr1=new XMLHttpRequest();
xhr1.open("get","http://chst.vip:1234/api/getbrandproductlist?brandtitleid="+csvalue,false)
xhr1.onload=function(){
   var lis='';
  if(xhr1.status===200){
  let res1=JSON.parse(xhr1.responseText);
  console.log(res1.result);
  res1.result.forEach(x => {
                   lis+=`
                   <li id=${x.productId}>
                  
                   ${x.productImg}
                   <div class="right">
                                <div class="title">${x.productName}</div> 
                                <p>${x.productPrice}</p>
                                <div class="bot">
                                                    <span>${x.productQuote}</span>
                                                    <span>${x.productCom}</span>
                                </div>
                   </div>       
                   </li>
                   ` 
  });
ulxuan.innerHTML=lis;
}}
xhr1.send();

// 点击获取id
$(".ulxuan>li").click(function(){
                    // console.log(+$(this).prop("id"));
                    window.location.href=`../html/last.html?productid=${+$(this).prop("id")}`
})